package cate.common.table.item.rune.row;

import cate.common.table.EExcelNoteField;
import cate.common.table.EExcelRowClass;
import cate.common.table.ERow;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

@EExcelRowClass(IDTitle = "强化等级")
public class RuneLevelUpRow extends ERow {
    @EExcelNoteField(fieldName = "需要经验")
    public int exp;

    @EExcelNoteField(fieldName = "增加属性")
    private String attrStr;

    public Map<Integer, Integer> attrs = new HashMap<>();
    @Override
    public void decode() {
        if (StringUtils.isNotBlank(attrStr)) {
            String[] arrStrArr = attrStr.split("#");
            for (String arrStr : arrStrArr) {
                String[] arr = arrStr.split(":");
                attrs.put(Integer.parseInt(arr[0]), Integer.parseInt(arr[1]));
            }
        }
    }
}
